home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / examples / exam14 / main.c < prev    next >
C/C++ Source or Header  |  1995-09-27  |  2KB  |  96 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. /*
  7.  *
  8.  *    This source code is CONFIDENTIAL and
  9.  *    PROPRIETARY to Algorithms Corporation. Unauthorized
  10.  *    distribution, adaptation or use    may
  11.  *    be subject to civil and    criminal penalties.
  12.  *
  13.  *    Copyright (c) 1993 Algorithms Corporation
  14.  *    3020 Liberty Hills Drive
  15.  *    Franklin, TN  37064
  16.  *
  17.  *    ALL RIGHTS RESERVED.
  18.  *
  19.  *
  20.  *
  21.  */
  22.  
  23.  
  24.  
  25. #include "generics.h"
  26.  
  27.  
  28. main(int argc, char *argv[])
  29. {
  30.     object    obj1, obj2;
  31.  
  32.     InitDynace(&argc);
  33.  
  34.     /*  Create two instances of the Class1 class.  This will evoke the
  35.         newly defined New class method through the gNew generic.  */
  36.  
  37.     obj1 = gNew(Class1);
  38.     obj2 = gNew(Class1);
  39.  
  40.     /*  Set each instance to a different name.  */
  41.  
  42.     gSetName(obj1, "Object One");
  43.     gSetName(obj2, "Object Two");
  44.  
  45.     /*  Display the independent values associated with each instance.  */
  46.  
  47.     printf("obj1's name is %s\n", gGetName(obj1));
  48.     printf("obj2's name is %s\n", gGetName(obj2));
  49.  
  50.     /*  Evoke the NumInstances class method through the gNumInstances
  51.         generic.  Notice that the argument passed is the class - not
  52.         an instance object.  This is because class methods are associated
  53.         with classes.  The returned value is printed.  */
  54.     
  55.     printf("Number of instances = %d\n", gNumInstances(Class1));
  56.  
  57.     /*  Dispose one of the instances.  */
  58.     gDispose(obj1);
  59.  
  60.     /*  Display the count again.  */
  61.     
  62.     printf("Number of instances = %d\n", gNumInstances(Class1));
  63.  
  64.     /*  Dispose and display the count again.  */
  65.  
  66.     gDispose(obj2);
  67.     printf("Number of instances = %d\n", gNumInstances(Class1));
  68.  
  69.     return 0;
  70. }
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. /*
  79.  *
  80.  *    This source code is CONFIDENTIAL and
  81.  *    PROPRIETARY to Algorithms Corporation. Unauthorized
  82.  *    distribution, adaptation or use    may
  83.  *    be subject to civil and    criminal penalties.
  84.  *
  85.  *    Copyright (c) 1993 Algorithms Corporation
  86.  *    3020 Liberty Hills Drive
  87.  *    Franklin, TN  37064
  88.  *
  89.  *    ALL RIGHTS RESERVED.
  90.  *
  91.  *
  92.  *
  93.  */
  94.  
  95.  
  96.